/* Testing the Bezier functions */
/* Andy Lynch */
/* An attempt to make something pleasing to the eye using Bezier curves */

AwareList mainList = new AwareList();

int circleRadius = 40;
int circleAlpha = 50;

void setup() 
{
  size( 600, 600); 
  frameRate( 30);

  int index = 0;
  BasePoint a1;
  BasePoint a2;
  BasePoint a3;
  BasePoint a4;
  a1 = new BouncePoint();
  a2 = new BouncePoint();
  a1.setDrawFlag( false);
  a2.setDrawFlag( false);
  mainList.addObj( a1);
  mainList.addObj( a2);
  color Start = getRandomColor( circleAlpha);
  for( index=0; index < 3; index ++){
   a3 = new BouncePoint();
   a4 = new BouncePoint();
   mainList.addObj( a3);
   mainList.addObj( a4);
   a3.setDrawFlag( false);
   a4.setDrawFlag( false);
   BounceBezier b = new BounceBezier( a1, a2, a3, a4);
   mainList.addObj( b);
   color End = getRandomColor( circleAlpha);
   b.setStartColor( Start);
   b.setEndColor( End);
   Start = End;
   a1 = a4;
   a2 = new FlipPoint( a1, a3);
   mainList.addObj( a2);
  };
}

void draw() 
{   
  color eColor;
  background( 0);
  mainList.update();
};

color getRandomColor( int cAlpha){
  color c;
  switch( int( random( 3))){
    case 0:
      c = color( 255, int(random( 256)), int(random( 256)), cAlpha);
      break;
    case 1:
      c = color( int(random( 256)), 255, int(random( 256)), cAlpha);
      break;
    default:
      c = color( int(random( 256)), int(random( 256)), 255, cAlpha);
      break;
  };
  return c;
};


